<!doctype html>
<html lang="en">

<%@ include file="Include_Professor_Imports.jsp"%>
<body>
<!-- HEADER -->
<div style="position: fixed; width: 100%; z-index: 1;">
<%@ include file="Include_Professor_Header.jsp"%>
<section id="secondary_bar">
<div class="user"><!-- <a class="logout_user" href="#" title="Logout">Logout</a> -->
</div>
<div class="breadcrumbs_container"><article class="breadcrumbs"><a
	href="ProfessorHomeServlet">Home</a>
<div class="breadcrumb_divider"></div>
<a class="current">Search</a></article></div>
</section>
<!-- end of secondary bar -->
</div>
<%@ include file="Include_Professor_Menu.jsp"%>


<c:set var="questions" value="${requestScope.questions}"></c:set>
<c:set var="students" value="${requestScope.students}" ></c:set>
<c:set var="exams" value="${requestScope.exams}" ></c:set>

<section id="main" class="column">

<%@ include file="Include_Professor_Message.jsp"%>

<div class="tablemodule" >
	<div style="max-height: 400px; overflow: auto;">
		<h5>Students <div >Search: <input name="filt" onKeyUp="filter2(this, 'examTable', '1')" type="text"></div></h5>
		<table class="tablesorter" id="studentTable" cellspacing="0">
	<thead>
		<tr>
			<th>User Id</th>
			<th>Last Name</th>
			<th>First Name</th>
			<th>Username</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach items="${students}" var="student">
			<tr>
				<td><c:out value="${student.userID}"></c:out></td>
				<td><c:out value="${student.lastName}"></c:out></td>
				<td><c:out value="${student.firstName}"></c:out></td>
				<td><c:out value="${student.username}"></c:out></td>
			</tr>
		</c:forEach>
	</tbody>
</table>
	</div>
</div>
	
<div class="tablemodule" >
	<div style="max-height: 400px; overflow: auto;">
		<h5>Exams <div>Search: <input name="filt" onKeyUp="filter2(this, 'examTable', '1')" type="text"></div></h5>
		<table class="tablesorter" id="examTable" cellspacing="0">
			<thead>
				<tr>
					<th>Exam ID</th>
					<th>Exam Name</th>
					<th># of Items</th>
					<th>Duration</th>
					<th>Passing</th>
					<th>Categories</th>
					<th>Status</th>
				</tr>
			</thead>
			<tbody>
			
				<c:forEach items="${exams}" var="exam" varStatus="i">
			
					<tr onclick="multiplehighlight_8(this, objinput0, examsRow)">
						<td><c:out value="${exam.examID }"/></td>
						<td><c:out value="${exam.examName }"/> </td>
						<td><c:out value="${exam.questions.size() }"/> </td>
						<td><c:out value="${exam.duration }"/></td>
						<td><c:out value="${exam.passingPercent }"/></td>
						<td>
							<c:forEach items="${categories[i.index]}" var="category" varStatus="j" >
							
								<c:choose>
									<c:when test="${categories[i.index].size() eq j.count}">
										<c:out value="${ category }" />
									</c:when>
									<c:otherwise>
										<c:out value="${category}," />
									</c:otherwise>
								</c:choose>
					
							</c:forEach>
						</td>
						<td>
							<c:choose>
								<c:when test="${exam.getClass().getSimpleName() eq 'RealExam'}">
									<c:choose>
										<c:when test="${exam.activated}">
											<a style="visibility: hidden;">A</a><input type="image" value="a" src="${pageContext.request.contextPath}/images/icn_alert_success.png" title="Activated" style="border-style: none">
										</c:when>
										<c:otherwise>
											<a style="visibility: hidden;">D</a><input type="image" value="b" src="${pageContext.request.contextPath}/images/icn_security.png" title="Locked" style="border-style: none">
										</c:otherwise>
									</c:choose>
								</c:when>
							</c:choose>
						</td>
					</tr>	
				</c:forEach>
			
			</tbody>
		</table>
	</div>
</div>

<div class="tablemodule" >
	<div style="max-height: 400px; overflow: auto;">
		<h5>Questions<div>Search: <input name="filt" onKeyUp="filter2(this, 'examTable', '1')" type="text"></div></h5>
			<table id="tableQuestions" class="tablesorter" cellspacing="0">
			<thead>
				<tr>
					<th>ID</th>
					<th>Question</th>
					<th>Category</th>
					<th>Type</th>
					<th>Answer</th>
					<th>Choices</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${questions}" var="questionObj">
				<tr>
					<td> <c:out value="${questionObj.questionID }"/> </td>
					<td> <c:out value="${questionObj.question }"/> </td>
					<td> <c:out value="${questionObj.category }"/> </td>
					<td>
						<c:choose>
							<c:when test="${questionObj.getClass().getSimpleName() eq 'MultipleChoice'}">
								Multiple Choice
							</c:when>
							<c:otherwise>
								True or False
							</c:otherwise>
						</c:choose>
					</td>
					<td> <c:out value="${questionObj.answer }"/> </td>
					<td>
						<c:forEach items="${questionObj.choices}" var="choices" varStatus="i" >
						
							<c:choose>
								<c:when test="${questions.size() eq i.count}">
									<c:out value="${ choices }" />
								</c:when>
								<c:otherwise>
									<c:out value="${choices}," />
								</c:otherwise>
							</c:choose>
													
						</c:forEach>
					</td>
				</tr>
				</c:forEach>
			</tbody>
		</table>
	</div>
</div>
	
<div class="spacer"></div>
</section>


</body>

</html>